<?php

include_once($_SERVER["DOCUMENT_ROOT"]."/functions/bdd/init.php");

function get_avion_donnees ($id){
    
    $bdd = bdd_init();
    
    $rep = $bdd->prepare("SELECT * FROM avion WHERE id=?");
    $rep->execute(array($id));
    $donnee = $rep->fetch();
    
    return $donnee;
}

function set_avion_donnees($nom, $description, $categorie, $difficulte, $stabilite, $stab_roul, $stab_tang, $vitesse, $decrochage, $reglages){
	
	$bdd = bdd_init();
	
	$rep = $bdd->prepare('INSERT INTO avion(nom, description, cat, difficulte, stabilite, date_de_post, stab_roul, stab_tang, vitesse, decrochage, reglages) VALUES(?, ?, ?, ?, ?, NOW(), ?, ?, ?, ?, ?)');
	$rep->execute(array($nom, $description, $categorie, $difficulte, $stabilite, $stab_roul, $stab_tang, $vitesse, $decrochage, $reglages));
	
	
	return $bdd->lastInsertId();
}
?>
